/* 
 * This file is part of Last.fm Now Playing Plugi-in for Adium
 * Copyright (c) 2011 Anton Bronnikov <anton.bronnikov@gmail.com>.
 * 
 * Last.fm Now Playing Plugi-in for Adium is free software: you can redistribute
 * it and/or modify it under the terms of the GNU General Public License as 
 * published by the Free Software Foundation, either version 3 of the License, 
 * or (at * your option) any later version.
 * 
 * Last.fm Now Playing Plugi-in for Adium is distributed in the hope that it 
 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General 
 * Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with 
 * Last.fm Now Playing Plugi-in for Adium. If not, see 
 * <http://www.gnu.org/licenses/>.
 *
 */

#import <Foundation/Foundation.h>
#import "LastFmTrack.h"

#pragma mark -
#pragma mark Protocol : LastFmObserver

@class LastFmNowPlayingObserver;

@protocol LastFmNowPlayingObserverDelegate

@optional

- (void) playingStarted:(LastFmNowPlayingObserver *)sender;
- (void) playingStopped:(LastFmNowPlayingObserver *)sender;
- (void) playingNewTrack:(LastFmNowPlayingObserver *)sender;

@end

#pragma mark -
#pragma mark Public interface : LastFmNowPlayingObserver

@interface LastFmNowPlayingObserver : NSObject {

@private
  
  NSObject <LastFmNowPlayingObserverDelegate> * _delegate;
  NSString * _lastFmUserID;
  BOOL _isEnabled;
  BOOL _isNowPlaying;
  LastFmTrack * _silence;
  LastFmTrack * _nowPlaying;
  NSTimer * _lastFmPollingTimer;

}

#pragma mark -
#pragma mark Properties

@property (assign, readwrite) NSObject <LastFmNowPlayingObserverDelegate> * delegate;
@property (copy, readwrite) NSString * lastFmUserID;
@property (assign, readwrite) BOOL isEnabled;
@property (assign, readonly)  BOOL isNowPlaying;
@property (retain, readonly) LastFmTrack * nowPlaying;
@property (retain, readonly) LastFmTrack * silence;

#pragma mark -
#pragma mark Methods

- (id) initWithLastFmUserID:(NSString *)initLastFmUserID state:(BOOL)initIsEnabled;
- (BOOL) validateLastFmUserID:(NSString *)someLastFmUserID;

@end
